package com.ttxs.uaa.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttxs.uaa.entity.SysRoleMenu;
import com.ttxs.uaa.mapper.SysRoleMenuMapper;
import com.ttxs.uaa.service.ISysRoleMenuService;
import org.springframework.stereotype.Service;

import java.util.Collection;

/**
 * <p>
 * 角色和菜单关联表 服务实现类
 * </p>
 *
 * @author 天天向上
 * @since 2021-07-26
 */
@Service
public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements ISysRoleMenuService {

    @Override
    public boolean removeByMenuIds(Collection<?> idList) {
        return getBaseMapper().delete(new LambdaQueryWrapper<SysRoleMenu>()
                .in(SysRoleMenu::getMenuId, idList)) > 0;
    }

    @Override
    public boolean removeByRoleIds(Collection<?> idList) {
        return getBaseMapper().delete(new LambdaQueryWrapper<SysRoleMenu>()
                .in(SysRoleMenu::getRoleId, idList)) > 0;
    }
}
